cnts <- read.csv('raw_counts_Cooper_data_final.csv')
rownames(cnts) <- cnts$X
cnts$X <- NULL
cnts <- as.matrix(cnts)
This takes raw_counts file and corrects the columns and index of the dataframe, then converts the file from a data frame to a matrix.
column_data <- read.csv('Cooper_Data_Meta.csv')
rownames(column_data) <- column_data$Sample
column_data <- column_data[,c("Tissue","Treatment","Stage")]
#column_data$Tissue <- factor(column_data$Tissue)
#column_data$Treatment <- factor(column_data$Treatment)
#column_data$Stage <- factor(column_data$Stage)
#column_data$Treatment <- NULL
#column_data$Stage <- NULL
#column_data$Sample <- NULL
column_data
## Tissue Treatment Stage
## SRR10912052 Serous_EOC Control 4B
## SRR10912053 Serous_EOC Platinum 4B
## SRR10912054 Serous_EOC Control 4
## SRR10912055 Serous_EOC Platinum 4
## SRR10912056 Serous_EOC Control 3C
## SRR10912057 Serous_EOC Platinum 3C
## SRR10912058 Serous_EOC Control 3C
## SRR10912059 Serous_EOC Platinum 3C
## SRR10912060 Serous_EOC Control 3C
## SRR10912061 Serous_EOC Platinum 3C
## SRR10912062 Serous_EOC Control 4
## SRR10912063 Serous_EOC Platinum 4
## SRR10912064 Serous_EOC Control 3C
## SRR10912065 Serous_EOC Platinum 3C
## SRR10912066 Serous_EOC Control 3C
## SRR10912067 Serous_EOC Platinum 3C
## SRR10912068 Serous_EOC Control 3C
## SRR10912069 Serous_EOC Platinum 3C
## SRR10912070 Serous_EOC Control 4
## SRR10912071 Serous_EOC Platinum 4
## SRR10912072 Serous_EOC Control 3C
## SRR10912073 Serous_EOC Control 3C
## SRR10912074 Serous_EOC Platinum 3C
## SRR10912075 Serous_EOC Control 3C
## SRR10912076 Serous_EOC Platinum 3C
## SRR10912077 Serous_EOC Platinum 3C
## SRR10912078 Serous_EOC Control 3C
## SRR10912079 Serous_EOC Platinum 3C
## SRR10912080 Serous_EOC Control 3C
## SRR10912081 Serous_EOC Platinum 3C
## SRR10912082 Serous_EOC Control 4
## SRR10912083 Serous_EOC Platinum 4
## SRR10912084 Serous_EOC Control 3C
## SRR10912085 Serous_EOC Platinum 3C
## SRR10912086 Serous_EOC Control 3C
## SRR10912087 Serous_EOC Platinum 3C
## SRR10912088 Serous_EOC Control 3C
## SRR10912089 Serous_EOC Control 3C
## SRR10912090 Serous_EOC Control 3C
## SRR10912091 Serous_EOC Control 3C
## SRR10912092 Serous_EOC Control 3C
## SRR10912093 Serous_EOC Control 4
## SRR10912094 Serous_EOC Control 3C
## SRR10912095 Serous_EOC Control 3C
## SRR10912096 Serous_EOC Control 3C
## SRR10912097 Serous_EOC Control 3C
## SRR10912098 Serous_EOC Control 3C
## SRR10912099 Serous_EOC Control 3C
## SRR10912100 Serous_EOC Control 3C
## SRR10912101 Serous_EOC Control 3C
## SRR10912102 Serous_EOC Control 3C
## SRR10912103 Serous_EOC Control 2C
## SRR10912104 Serous_EOC Control 3C
## SRR10912105 Serous_EOC Control 4
## SRR10912106 Serous_EOC Control 3C
## SRR10912107 Serous_EOC Control 3C
## SRR10912108 Serous_EOC Control 3C
## SRR10912109 Serous_EOC Control 4
## SRR10912110 Serous_EOC Control 3C
## SRR10912111 Serous_EOC Control 3C
## SRR10912112 Serous_EOC Control 3C
## SRR10912113 Serous_EOC Control 3C
## SRR10912114 Serous_EOC Control 3C
## SRR10912115 Serous_EOC Control 4
## SRR10912116 Serous_EOC Control 3C
## SRR10912117 Serous_EOC Control 3C
## SRR10912118 Serous_EOC Control 3C
## SRR10912119 Serous_EOC Control 3C
## SRR10912120 Serous_EOC Control 4
## SRR10912121 Serous_EOC Control 3C
## SRR10912122 Serous_EOC Control 3C
## SRR10912123 Serous_EOC Control 3C
## SRR10912124 Serous_EOC Control 4
## SRR10912125 Serous_EOC Control 3C
## SRR10912126 Serous_EOC Control 4
## SRR10912127 Benign_Tissue Control patientid: 61
## SRR10912128 Benign_Tissue Control patientid: 62
## SRR10912129 Benign_Tissue Control patientid: 63
## SRR10912130 Benign_Tissue Control patientid: 64
## SRR10912131 Benign_Tissue Control patientid: 65
## SRR10912132 Benign_Tissue Control patientid: 66
## SRR10912133 Benign_Tissue Control patientid: 67
## SRR10912134 Benign_Tissue Control patientid: 68
## SRR10912135 Benign_Tissue Control patientid: 69
## SRR10912136 Benign_Tissue Control patientid: 70
## SRR10912137 Benign_Tissue Control patientid: 71
## SRR10912138 Ascites Control 4A
## SRR10912139 Ascites Control 3C
## SRR10912140 Ascites Control 3C
## SRR10912141 Ascites Control 3C
## SRR10912142 Serous_EOC Control 4A
## SRR10912143 Serous_EOC Control 3C
## SRR10912144 Benign_Tissue Control patientid: 78
## SRR10912145 Serous_EOC Control 3C
## SRR10912146 Serous_EOC Control 3C
## SRR10912147 Ascites Control 3C
## SRR10912148 Ascites Control 3C
## SRR10912149 Ascites Control 3C
## SRR10912150 Ascites Control 3C
## SRR10912151 Ascites Control 3C
## SRR10912152 Ascites Control 4
## SRR10912153 Ascites Control 3C
## SRR10912154 Ascites Control 3C
## SRR10912155 Ascites Control 3C
## SRR10912156 Ascites Control 3C
## SRR10912157 Ascites Control 3C
## SRR10912158 Ascites Control 3C
## SRR10912159 Ascites Control 3C
## SRR10912160 Ascites Control 3C
## SRR10912161 Ascites Control 2C
## SRR10912162 Ascites Control 3C
## SRR10912163 Ascites Control 4
## SRR10912164 Ascites Control 3C
## SRR10912165 Ascites Control 3C
## SRR10912166 Ascites Control 3C
## SRR10912167 Ascites Control 3C
## SRR10912168 Ascites Control 4
## SRR10912169 Ascites Control 3C
## SRR10912170 Ascites Control 3C
## SRR10912171 Ascites Control 3C
## SRR10912172 Ascites Control 4
This takes the metadata, or column data, file and corrects the columns and index of the dataframe, then converts the file from a data frame to a matrix.
all(rownames(column_data) %in% colnames(cnts))
## [1] TRUE
all(rownames(column_data) == colnames(cnts))
## [1] TRUE
This checks if the rownames and column names match.
library("DESeq2")
## Loading required package: S4Vectors
## Loading required package: stats4
## Loading required package: BiocGenerics
##
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:stats':
##
## IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
##
## anyDuplicated, aperm, append, as.data.frame, basename, cbind,
## colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find,
## get, grep, grepl, intersect, is.unsorted, lapply, Map, mapply,
## match, mget, order, paste, pmax, pmax.int, pmin, pmin.int,
## Position, rank, rbind, Reduce, rownames, sapply, setdiff, sort,
## table, tapply, union, unique, unsplit, which.max, which.min
##
## Attaching package: 'S4Vectors'
## The following object is masked from 'package:utils':
##
## findMatches
## The following objects are masked from 'package:base':
##
## expand.grid, I, unname
## Loading required package: IRanges
## Loading required package: GenomicRanges
## Loading required package: GenomeInfoDb
## Loading required package: SummarizedExperiment
## Loading required package: MatrixGenerics
## Loading required package: matrixStats
##
## Attaching package: 'MatrixGenerics'
## The following objects are masked from 'package:matrixStats':
##
## colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
## colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
## colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
## colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
## colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
## colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
## colWeightedMeans, colWeightedMedians, colWeightedSds,
## colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
## rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
## rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
## rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
## rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
## rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
## rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
## rowWeightedSds, rowWeightedVars
## Loading required package: Biobase
## Welcome to Bioconductor
##
## Vignettes contain introductory material; view with
## 'browseVignettes()'. To cite Bioconductor, see
## 'citation("Biobase")', and for packages 'citation("pkgname")'.
##
## Attaching package: 'Biobase'
## The following object is masked from 'package:MatrixGenerics':
##
## rowMedians
## The following objects are masked from 'package:matrixStats':
##
## anyMissing, rowMedians
dds <- DESeqDataSetFromMatrix(countData = cnts,
colData = column_data,
design = ~ Tissue)
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
dds
## class: DESeqDataSet
## dim: 20643 121
## metadata(1): version
## assays(1): counts
## rownames(20643): ENSG00000000003 ENSG00000000005 ... ENSG00000273439
## ENSG00000273452
## rowData names(0):
## colnames(121): SRR10912052 SRR10912053 ... SRR10912171 SRR10912172
## colData names(3): Tissue Treatment Stage
keep <- rowSums(counts(dds)) >= 10
dds <- dds[keep,]
Prefiltering can improve visualization as features with no information are not plotted.
dds$Tissue <- relevel(dds$Tissue, ref = "Benign_Tissue")
“By default, R will choose a reference level for factors
based on alphabetical order. Then, if you never tell the DESeq2
functions which level you want to compare against (e.g. which level
represents the control group), the comparisons will be based on the
alphabetical order of the levels. There are two solutions: you can
either explicitly tell results which comparison to make using
the contrast argument (this will be shown later), or you
can explicitly set the factors levels. In order to see the change of
reference levels reflected in the results names, you need to either run
DESeq or nbinomWaldTest/nbinomLRT
after the re-leveling operation.”
Setting Benign Tissue as the reference level.
dds <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 1168 genes
## -- DESeq argument 'minReplicatesForReplace' = 7
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
resultsNames(dds)
## [1] "Intercept" "Tissue_Ascites_vs_Benign_Tissue"
## [3] "Tissue_Serous_EOC_vs_Benign_Tissue"
#summary(res)
res_Serous_EOC <- results(dds, name="Tissue_Serous_EOC_vs_Benign_Tissue")
res_Serous_EOC
## log2 fold change (MLE): Tissue Serous EOC vs Benign Tissue
## Wald test p-value: Tissue Serous EOC vs Benign Tissue
## DataFrame with 19975 rows and 6 columns
## baseMean log2FoldChange lfcSE stat pvalue
## <numeric> <numeric> <numeric> <numeric> <numeric>
## ENSG00000000003 1359.4263 -0.790170 0.248072 -3.185252 1.44628e-03
## ENSG00000000005 28.6264 -0.512972 0.913941 -0.561275 5.74610e-01
## ENSG00000000419 945.1298 0.408815 0.156660 2.609561 9.06584e-03
## ENSG00000000457 339.0323 -0.139602 0.124784 -1.118752 2.63246e-01
## ENSG00000000460 189.3951 1.346737 0.231249 5.823762 5.75375e-09
## ... ... ... ... ... ...
## ENSG00000273294 18.6100019 0.115738 0.774778 0.1493822 0.881252
## ENSG00000273331 1.6135503 2.457218 1.142924 2.1499398 0.031560
## ENSG00000273398 5.7510137 0.562653 0.536606 1.0485403 0.294390
## ENSG00000273439 22.4666648 0.669630 0.415259 1.6125583 0.106841
## ENSG00000273452 0.0657423 0.197680 4.954781 0.0398967 0.968175
## padj
## <numeric>
## ENSG00000000003 3.91623e-03
## ENSG00000000005 6.64751e-01
## ENSG00000000419 1.99003e-02
## ENSG00000000457 3.58693e-01
## ENSG00000000460 5.14674e-08
## ... ...
## ENSG00000273294 0.9141591
## ENSG00000273331 0.0593248
## ENSG00000273398 0.3925197
## ENSG00000273439 0.1682453
## ENSG00000273452 NA
resLFC_Serous_EOC <- lfcShrink(dds, coef="Tissue_Serous_EOC_vs_Benign_Tissue", type="apeglm")
## using 'apeglm' for LFC shrinkage. If used in published research, please cite:
## Zhu, A., Ibrahim, J.G., Love, M.I. (2018) Heavy-tailed prior distributions for
## sequence count data: removing the noise and preserving large differences.
## Bioinformatics. https://doi.org/10.1093/bioinformatics/bty895
resLFC_Serous_EOC
## log2 fold change (MAP): Tissue Serous EOC vs Benign Tissue
## Wald test p-value: Tissue Serous EOC vs Benign Tissue
## DataFrame with 19975 rows and 5 columns
## baseMean log2FoldChange lfcSE pvalue padj
## <numeric> <numeric> <numeric> <numeric> <numeric>
## ENSG00000000003 1359.4263 -0.707614 0.238990 1.44628e-03 3.91623e-03
## ENSG00000000005 28.6264 -0.256894 0.633896 5.74610e-01 6.64751e-01
## ENSG00000000419 945.1298 0.397866 0.155273 9.06584e-03 1.99003e-02
## ENSG00000000457 339.0323 -0.136250 0.123498 2.63246e-01 3.58693e-01
## ENSG00000000460 189.3951 1.301129 0.234105 5.75375e-09 5.14674e-08
## ... ... ... ... ... ...
## ENSG00000273294 18.6100019 0.0682127 0.587723 0.881252 0.9141591
## ENSG00000273331 1.6135503 3.6905904 1.538611 0.031560 0.0593248
## ENSG00000273398 5.7510137 0.4212642 0.487248 0.294390 0.3925197
## ENSG00000273439 22.4666648 0.5644270 0.401099 0.106841 0.1682453
## ENSG00000273452 0.0657423 0.0337805 0.882672 0.968175 NA
res_Ascites <- results(dds, name="Tissue_Ascites_vs_Benign_Tissue")
res_Ascites
## log2 fold change (MLE): Tissue Ascites vs Benign Tissue
## Wald test p-value: Tissue Ascites vs Benign Tissue
## DataFrame with 19975 rows and 6 columns
## baseMean log2FoldChange lfcSE stat pvalue
## <numeric> <numeric> <numeric> <numeric> <numeric>
## ENSG00000000003 1359.4263 -0.914937 0.275916 -3.31600 9.13167e-04
## ENSG00000000005 28.6264 -4.565551 1.029674 -4.43398 9.25110e-06
## ENSG00000000419 945.1298 0.487980 0.175152 2.78604 5.33562e-03
## ENSG00000000457 339.0323 -0.448853 0.141450 -3.17321 1.50761e-03
## ENSG00000000460 189.3951 1.099443 0.259719 4.23321 2.30384e-05
## ... ... ... ... ... ...
## ENSG00000273294 18.6100019 -0.553297 0.866688 -0.638404 0.5232107
## ENSG00000273331 1.6135503 2.834898 1.244909 2.277193 0.0227747
## ENSG00000273398 5.7510137 -0.419677 0.607245 -0.691117 0.4894919
## ENSG00000273439 22.4666648 -0.072854 0.470010 -0.155005 0.8768173
## ENSG00000273452 0.0657423 2.226346 5.458155 0.407893 0.6833519
## padj
## <numeric>
## ENSG00000000003 2.17650e-03
## ENSG00000000005 3.16468e-05
## ENSG00000000419 1.08888e-02
## ENSG00000000457 3.44937e-03
## ENSG00000000460 7.32642e-05
## ... ...
## ENSG00000273294 0.6021114
## ENSG00000273331 0.0401088
## ENSG00000273398 0.5705074
## ENSG00000273439 0.9009092
## ENSG00000273452 0.7426654
resLFC_Ascites <- lfcShrink(dds, coef="Tissue_Ascites_vs_Benign_Tissue", type="apeglm")
## using 'apeglm' for LFC shrinkage. If used in published research, please cite:
## Zhu, A., Ibrahim, J.G., Love, M.I. (2018) Heavy-tailed prior distributions for
## sequence count data: removing the noise and preserving large differences.
## Bioinformatics. https://doi.org/10.1093/bioinformatics/bty895
resLFC_Ascites
## log2 fold change (MAP): Tissue Ascites vs Benign Tissue
## Wald test p-value: Tissue Ascites vs Benign Tissue
## DataFrame with 19975 rows and 5 columns
## baseMean log2FoldChange lfcSE pvalue padj
## <numeric> <numeric> <numeric> <numeric> <numeric>
## ENSG00000000003 1359.4263 -0.837964 0.267011 9.13167e-04 2.17650e-03
## ENSG00000000005 28.6264 -0.844550 0.833044 9.25110e-06 3.16468e-05
## ENSG00000000419 945.1298 0.475800 0.173115 5.33562e-03 1.08888e-02
## ENSG00000000457 339.0323 -0.441299 0.139981 1.50761e-03 3.44937e-03
## ENSG00000000460 189.3951 1.050195 0.259593 2.30384e-05 7.32642e-05
## ... ... ... ... ... ...
## ENSG00000273294 18.6100019 -0.4558388 0.684649 0.5232107 0.6021114
## ENSG00000273331 1.6135503 0.8943902 1.171554 0.0227747 0.0401088
## ENSG00000273398 5.7510137 -0.5741662 0.558885 0.4894919 0.5705074
## ENSG00000273439 22.4666648 -0.1303708 0.426959 0.8768173 0.9009092
## ENSG00000273452 0.0657423 0.0804353 1.022513 0.6833519 0.7426654
Using lfcShrik to make vizualization and ranking of genes better.
resLFCOrdered_Serous_EOC <- resLFC_Serous_EOC[order(resLFC_Serous_EOC$pvalue),]
resLFCOrdered_Serous_EOC
## log2 fold change (MAP): Tissue Serous EOC vs Benign Tissue
## Wald test p-value: Tissue Serous EOC vs Benign Tissue
## DataFrame with 19975 rows and 5 columns
## baseMean log2FoldChange lfcSE pvalue padj
## <numeric> <numeric> <numeric> <numeric> <numeric>
## ENSG00000100380 5724.9650 -2.36653 0.160123 6.74717e-50 9.08323e-46
## ENSG00000154545 61.4084 11.23218 3.529445 9.46367e-50 9.08323e-46
## ENSG00000100227 1539.3231 -1.92776 0.143622 2.46081e-41 1.57459e-37
## ENSG00000139734 173.2278 4.27102 0.321202 9.45548e-41 4.53768e-37
## ENSG00000069966 566.3977 -2.15348 0.163485 4.28627e-40 1.64559e-36
## ... ... ... ... ... ...
## ENSG00000184007 3630.87 0.000342523 0.127981 0.999963 0.999963
## ENSG00000154537 0.00 0.069290955 0.887184 1.000000 NA
## ENSG00000242366 0.00 0.061543666 0.885882 1.000000 NA
## ENSG00000255863 0.00 0.071625991 0.887520 1.000000 NA
## ENSG00000268485 0.00 0.068737657 0.887100 1.000000 NA
resLFCOrdered_Ascites <- resLFC_Ascites[order(resLFC_Ascites$pvalue),]
resLFCOrdered_Ascites
## log2 fold change (MAP): Tissue Ascites vs Benign Tissue
## Wald test p-value: Tissue Ascites vs Benign Tissue
## DataFrame with 19975 rows and 5 columns
## baseMean log2FoldChange lfcSE pvalue padj
## <numeric> <numeric> <numeric> <numeric> <numeric>
## ENSG00000115461 16817.080 -6.76674 0.420994 4.15654e-58 8.30102e-54
## ENSG00000100380 5724.965 -2.74955 0.178141 2.86234e-54 2.85819e-50
## ENSG00000072840 769.001 -3.36303 0.223246 7.75342e-52 5.16145e-48
## ENSG00000100227 1539.323 -2.41606 0.161322 2.93616e-51 1.46595e-47
## ENSG00000113658 1041.526 -2.28680 0.158517 1.05393e-47 4.20962e-44
## ... ... ... ... ... ...
## ENSG00000147596 3.33851 -0.1884468 0.527538 0.999197 0.999197
## ENSG00000154537 0.00000 -0.0302969 1.017772 1.000000 NA
## ENSG00000242366 0.00000 -0.0277997 1.017821 1.000000 NA
## ENSG00000255863 0.00000 -0.0311519 1.017759 1.000000 NA
## ENSG00000268485 0.00000 -0.0301904 1.017780 1.000000 NA
Ordered by p-value.
summary(resLFCOrdered_Serous_EOC)
##
## out of 19971 with nonzero total read count
## adjusted p-value < 0.1
## LFC > 0 (up) : 6618, 33%
## LFC < 0 (down) : 4518, 23%
## outliers [1] : 0, 0%
## low counts [2] : 779, 3.9%
## (mean count < 0)
## [1] see 'cooksCutoff' argument of ?results
## [2] see 'independentFiltering' argument of ?results
summary(resLFCOrdered_Ascites)
##
## out of 19971 with nonzero total read count
## adjusted p-value < 0.1
## LFC > 0 (up) : 6636, 33%
## LFC < 0 (down) : 6123, 31%
## outliers [1] : 0, 0%
## low counts [2] : 4, 0.02%
## (mean count < 0)
## [1] see 'cooksCutoff' argument of ?results
## [2] see 'independentFiltering' argument of ?results
plotMA(resLFCOrdered_Serous_EOC, ylim=c(-2,2))
idx_LFCOrdered_Serous_EOC <- identify(resLFCOrdered_Serous_EOC$baseMean, resLFCOrdered_Serous_EOC$log2FoldChange)
rownames(resLFCOrdered_Serous_EOC)[idx_LFCOrdered_Serous_EOC]
## character(0)
plotMA(resLFCOrdered_Ascites, ylim=c(-2,2))
plotMA(resLFCOrdered_Serous_EOC, ylim=c(-2,2))
idx_LFCOrdered_Serous_EOC <- identify(resLFCOrdered_Serous_EOC$baseMean, resLFCOrdered_Serous_EOC$log2FoldChange)
rownames(resLFCOrdered_Serous_EOC)[idx_LFCOrdered_Serous_EOC]
## character(0)
resNorm <- lfcShrink(dds, coef=3, type="normal")
## using 'normal' for LFC shrinkage, the Normal prior from Love et al (2014).
##
## Note that type='apeglm' and type='ashr' have shown to have less bias than type='normal'.
## See ?lfcShrink for more details on shrinkage type, and the DESeq2 vignette.
## Reference: https://doi.org/10.1093/bioinformatics/bty895
resAsh <- lfcShrink(dds, coef=3, type="ashr")
## using 'ashr' for LFC shrinkage. If used in published research, please cite:
## Stephens, M. (2016) False discovery rates: a new deal. Biostatistics, 18:2.
## https://doi.org/10.1093/biostatistics/kxw041
resLFC <- lfcShrink(dds, coef=3, type="apeglm")
## using 'apeglm' for LFC shrinkage. If used in published research, please cite:
## Zhu, A., Ibrahim, J.G., Love, M.I. (2018) Heavy-tailed prior distributions for
## sequence count data: removing the noise and preserving large differences.
## Bioinformatics. https://doi.org/10.1093/bioinformatics/bty895
par(mfrow=c(1,3), mar=c(4,4,2,1))
xlim <- c(1,1e5); ylim <- c(-3,3)
plotMA(resLFC, xlim=xlim, ylim=ylim, main="apeglm")
plotMA(resNorm, xlim=xlim, ylim=ylim, main="normal")
plotMA(resAsh, xlim=xlim, ylim=ylim, main="ashr")
plotCounts(dds, gene=which.min(resLFC_Serous_EOC$padj), intgroup="Tissue")
plotCounts(dds, gene=which.min(resLFC_Ascites$padj), intgroup="Tissue")
plotCounts(dds, gene=which.max(resLFC_Serous_EOC$padj), intgroup="Tissue")
plotCounts(dds, gene=which.max(resLFC_Ascites$padj), intgroup="Tissue")
vsd <- vst(dds, blind=FALSE)
#rld <- rlog(dds, blind=FALSE)
ntd <- normTransform(dds)
library("vsn")
head(assay(vsd), 10)
## SRR10912052 SRR10912053 SRR10912054 SRR10912055 SRR10912056
## ENSG00000000003 9.681800 11.409086 10.373103 10.861253 9.804261
## ENSG00000000005 5.657905 7.242788 7.324413 5.657905 5.657905
## ENSG00000000419 10.143497 9.959867 10.159948 10.482950 10.201271
## ENSG00000000457 8.778506 8.722905 8.701035 8.582886 8.955522
## ENSG00000000460 8.362459 7.709567 8.302766 7.852794 7.959261
## ENSG00000000938 8.780148 8.866326 8.220189 6.892303 8.679407
## ENSG00000000971 11.347021 12.181838 12.121527 9.671775 13.727215
## ENSG00000001036 10.324587 10.764334 10.538936 9.731350 10.829804
## ENSG00000001084 8.812592 9.807770 9.398510 9.429871 9.110757
## ENSG00000001167 9.789864 9.155460 9.201835 9.320337 9.062793
## SRR10912057 SRR10912058 SRR10912059 SRR10912060 SRR10912061
## ENSG00000000003 10.682838 9.112636 8.461819 10.639874 10.202538
## ENSG00000000005 5.834671 6.058665 5.657905 6.745606 5.657905
## ENSG00000000419 10.023898 9.791563 9.282585 10.369044 9.815419
## ENSG00000000457 8.986655 8.742551 8.358014 8.744751 8.705403
## ENSG00000000460 8.710638 7.591303 7.993237 7.186378 5.657905
## ENSG00000000938 7.648104 10.074286 10.837538 7.853983 8.663492
## ENSG00000000971 11.194760 13.162126 11.148968 12.214480 11.413431
## ENSG00000001036 10.445657 10.926095 11.153241 10.424914 10.027705
## ENSG00000001084 9.669354 9.722022 9.641572 8.383807 8.633388
## ENSG00000001167 9.844475 9.114695 8.595770 9.295579 9.002105
## SRR10912062 SRR10912063 SRR10912064 SRR10912065 SRR10912066
## ENSG00000000003 10.479004 9.696886 11.402766 10.635603 10.662796
## ENSG00000000005 5.657905 6.540222 5.657905 6.048287 6.043689
## ENSG00000000419 9.998549 9.591109 9.994770 9.665286 10.498476
## ENSG00000000457 7.540698 8.059312 9.196570 9.322005 8.367355
## ENSG00000000460 8.117656 8.041946 8.708845 8.244808 8.577920
## ENSG00000000938 8.856192 9.497592 8.243940 8.463016 6.875277
## ENSG00000000971 12.171610 12.334648 12.146060 12.311195 10.779275
## ENSG00000001036 10.932153 10.660764 10.754683 10.506151 10.429774
## ENSG00000001084 9.437551 10.370967 9.628905 9.583375 9.188028
## ENSG00000001167 9.064419 9.085622 9.245514 9.145594 9.537424
## SRR10912067 SRR10912068 SRR10912069 SRR10912070 SRR10912071
## ENSG00000000003 9.514325 9.748332 8.928942 10.655050 9.182824
## ENSG00000000005 6.062590 6.024113 6.033176 5.906723 5.966233
## ENSG00000000419 10.218577 10.090740 9.729964 10.343107 10.317958
## ENSG00000000457 8.856011 8.879201 8.956091 8.810905 8.523476
## ENSG00000000460 7.857643 8.024855 7.788848 8.499530 7.790599
## ENSG00000000938 11.264581 9.000551 10.138362 7.652670 9.462310
## ENSG00000000971 10.352780 11.321204 11.565934 11.378536 13.652808
## ENSG00000001036 10.493664 10.356254 10.325404 10.304064 10.271805
## ENSG00000001084 10.077249 9.041806 9.421800 9.444026 9.161434
## ENSG00000001167 9.114372 9.555633 9.289950 9.149040 8.936867
## SRR10912072 SRR10912073 SRR10912074 SRR10912075 SRR10912076
## ENSG00000000003 9.789805 11.805167 10.369948 9.528750 9.369386
## ENSG00000000005 5.859382 6.659314 7.349422 5.657905 7.217420
## ENSG00000000419 9.869783 10.405773 10.355734 9.860681 9.958212
## ENSG00000000457 8.597413 9.256500 9.136575 9.553261 9.034634
## ENSG00000000460 8.500700 8.517670 8.866012 8.830151 7.911606
## ENSG00000000938 8.691349 6.881988 8.925536 8.722829 9.153147
## ENSG00000000971 12.707167 8.275037 10.985326 10.365997 12.363049
## ENSG00000001036 10.318118 9.742067 10.369948 9.985780 9.956461
## ENSG00000001084 9.152122 9.668891 9.778350 9.639703 9.747536
## ENSG00000001167 9.206526 10.435005 9.878489 9.632057 9.041300
## SRR10912077 SRR10912078 SRR10912079 SRR10912080 SRR10912081
## ENSG00000000003 9.237389 11.686149 11.652404 10.949399 9.884800
## ENSG00000000005 6.335134 7.790812 6.513903 5.657905 5.853438
## ENSG00000000419 9.695735 10.505656 10.398156 11.690905 10.842806
## ENSG00000000457 8.858825 8.695915 8.726438 8.675206 8.720754
## ENSG00000000460 7.905158 8.464077 7.902284 8.496152 7.790266
## ENSG00000000938 9.729510 7.692708 7.216529 7.834771 9.635456
## ENSG00000000971 12.557434 11.256344 12.572694 11.313913 12.410532
## ENSG00000001036 10.501549 10.498353 10.290944 11.849828 11.387249
## ENSG00000001084 9.420927 9.000285 9.335599 10.360706 9.871949
## ENSG00000001167 9.121185 10.372169 9.683824 9.518110 8.876175
## SRR10912082 SRR10912083 SRR10912084 SRR10912085 SRR10912086
## ENSG00000000003 10.731144 10.626092 10.391571 9.856398 10.063216
## ENSG00000000005 5.657905 5.657905 5.657905 8.312581 9.890164
## ENSG00000000419 10.106190 10.459343 10.316807 10.277954 9.932346
## ENSG00000000457 9.471265 8.715264 8.799716 8.959380 8.697414
## ENSG00000000460 9.322198 8.184746 8.685387 7.888386 7.847349
## ENSG00000000938 8.230518 7.908309 8.739724 8.987737 9.060709
## ENSG00000000971 11.376767 12.608898 11.601021 13.279539 12.940010
## ENSG00000001036 9.516211 10.019321 10.552999 10.455881 10.626832
## ENSG00000001084 9.980664 9.376255 9.843706 9.739313 9.748638
## ENSG00000001167 10.132336 9.979692 9.969251 9.828365 8.866547
## SRR10912087 SRR10912088 SRR10912089 SRR10912090 SRR10912091
## ENSG00000000003 10.120827 10.632332 10.750688 10.123521 9.854531
## ENSG00000000005 8.319678 6.594620 6.053124 5.839106 6.584189
## ENSG00000000419 10.170484 10.062837 9.774579 9.751626 9.564163
## ENSG00000000457 9.112089 9.391028 8.996665 8.632326 8.715865
## ENSG00000000460 7.547950 8.538632 9.095365 7.636814 7.694398
## ENSG00000000938 10.262584 7.579326 7.497154 7.862851 7.712670
## ENSG00000000971 12.348515 10.132630 9.212140 11.335545 12.672983
## ENSG00000001036 10.334697 10.124089 11.204638 10.019598 10.092598
## ENSG00000001084 10.053189 9.559337 9.471102 8.982612 8.662969
## ENSG00000001167 9.244730 9.388645 9.431611 8.882670 8.772389
## SRR10912092 SRR10912093 SRR10912094 SRR10912095 SRR10912096
## ENSG00000000003 9.690714 9.773876 9.579622 10.102560 10.589301
## ENSG00000000005 8.596961 5.657905 5.888589 5.909040 5.966965
## ENSG00000000419 9.457148 10.056925 9.664049 10.200022 9.631575
## ENSG00000000457 8.509949 9.444754 8.808824 8.746192 8.825123
## ENSG00000000460 7.657982 8.724068 8.342910 7.990393 8.378910
## ENSG00000000938 9.221176 7.118030 7.965176 7.540845 7.778890
## ENSG00000000971 12.888248 9.997007 8.607472 11.344746 10.803650
## ENSG00000001036 10.539513 9.980753 9.948034 10.236310 9.962584
## ENSG00000001084 9.564194 8.540289 9.090626 9.241295 9.513569
## ENSG00000001167 9.260549 9.147596 8.697005 9.533242 9.597184
## SRR10912097 SRR10912098 SRR10912099 SRR10912100 SRR10912101
## ENSG00000000003 11.917693 10.727720 11.769118 10.730239 10.127653
## ENSG00000000005 6.775833 5.840411 5.657905 5.657905 5.657905
## ENSG00000000419 9.469495 9.354318 10.179571 9.974597 9.538607
## ENSG00000000457 8.889644 8.642477 9.182089 8.884587 8.232557
## ENSG00000000460 7.459067 7.679849 8.961568 8.881745 7.475655
## ENSG00000000938 6.978535 7.844592 6.463177 7.574433 7.505389
## ENSG00000000971 12.436809 10.611550 7.538526 10.600251 11.531618
## ENSG00000001036 11.046980 9.343513 10.749000 9.609189 9.802213
## ENSG00000001084 8.017013 8.703462 10.052257 9.155124 9.037496
## ENSG00000001167 9.456906 9.026969 10.028862 9.384264 9.795277
## SRR10912102 SRR10912103 SRR10912104 SRR10912105 SRR10912106
## ENSG00000000003 9.388029 10.768546 10.662914 10.441764 10.054127
## ENSG00000000005 8.013932 5.897503 6.325378 5.913889 6.284343
## ENSG00000000419 9.048870 11.036591 10.505685 9.626125 9.585915
## ENSG00000000457 8.615069 8.894731 8.733927 8.903725 8.604968
## ENSG00000000460 7.241883 9.250399 8.465158 7.981010 8.345257
## ENSG00000000938 9.351160 7.312097 8.292841 7.846434 7.805776
## ENSG00000000971 12.581507 8.971749 10.120269 9.127736 10.652037
## ENSG00000001036 10.216597 10.879143 10.023739 10.264039 9.860845
## ENSG00000001084 9.866794 9.628368 9.676119 10.030685 10.014120
## ENSG00000001167 8.979839 9.641085 9.898180 9.866292 9.464691
## SRR10912107 SRR10912108 SRR10912109 SRR10912110 SRR10912111
## ENSG00000000003 9.838507 9.999543 11.060003 10.957206 9.354553
## ENSG00000000005 6.397608 5.964393 6.371779 6.703043 5.977341
## ENSG00000000419 9.685932 9.556288 9.419346 9.590830 10.376476
## ENSG00000000457 8.182953 9.154727 8.625538 8.899580 8.966275
## ENSG00000000460 7.941163 8.197571 7.698895 8.043477 8.730311
## ENSG00000000938 8.566607 7.953876 7.563975 7.013731 7.760243
## ENSG00000000971 8.939289 10.077371 10.494718 9.782016 9.302175
## ENSG00000001036 9.663395 10.297584 10.618685 9.724768 10.291157
## ENSG00000001084 9.248075 9.322414 9.171858 10.042092 8.826827
## ENSG00000001167 8.959294 9.278970 9.378679 9.528836 9.958276
## SRR10912112 SRR10912113 SRR10912114 SRR10912115 SRR10912116
## ENSG00000000003 10.549125 10.169169 9.996266 11.065692 10.902300
## ENSG00000000005 5.657905 6.326860 6.035439 6.244687 5.657905
## ENSG00000000419 9.646125 10.161344 10.365855 10.019270 9.938859
## ENSG00000000457 9.053949 8.848088 8.596867 8.958203 8.876283
## ENSG00000000460 8.898865 8.496749 8.227468 8.459481 7.870837
## ENSG00000000938 7.434567 7.971937 7.364498 7.415554 7.100761
## ENSG00000000971 9.592380 10.305563 9.928723 10.170340 10.783769
## ENSG00000001036 10.057250 10.444526 10.124312 9.484405 9.825351
## ENSG00000001084 9.106949 9.324805 9.535727 8.553655 8.934686
## ENSG00000001167 9.230434 10.039492 10.144881 9.996473 9.352783
## SRR10912117 SRR10912118 SRR10912119 SRR10912120 SRR10912121
## ENSG00000000003 10.870113 9.791178 10.165048 10.569699 9.015377
## ENSG00000000005 5.857542 8.312728 6.100406 5.657905 5.657905
## ENSG00000000419 10.148289 8.973836 9.788153 10.042770 11.134821
## ENSG00000000457 8.950647 8.810180 8.608425 8.703128 8.566547
## ENSG00000000460 8.631807 7.705391 8.511551 8.292418 8.355014
## ENSG00000000938 7.420482 8.996380 8.176935 7.730380 8.085127
## ENSG00000000971 9.764560 11.878304 11.328730 11.961958 10.352330
## ENSG00000001036 10.424611 9.963537 10.097171 10.274575 10.198448
## ENSG00000001084 9.965713 9.548955 9.873345 8.995594 9.416324
## ENSG00000001167 9.134977 8.899180 10.474080 9.634069 8.879204
## SRR10912122 SRR10912123 SRR10912124 SRR10912125 SRR10912126
## ENSG00000000003 10.032690 10.087136 9.571070 10.769773 9.998517
## ENSG00000000005 5.917593 5.846894 5.657905 6.315303 6.083379
## ENSG00000000419 9.792948 10.325678 9.571070 9.705033 9.722388
## ENSG00000000457 8.428563 8.588788 8.249535 8.807468 8.599225
## ENSG00000000460 8.240850 8.653428 7.277281 8.350049 7.800779
## ENSG00000000938 7.679525 6.975433 10.694501 7.674585 8.072405
## ENSG00000000971 11.161452 11.393834 12.002600 11.354242 11.397260
## ENSG00000001036 10.541345 10.350856 10.290530 10.721072 10.140321
## ENSG00000001084 9.287902 9.326182 9.759159 9.412767 8.685759
## ENSG00000001167 9.587543 9.413703 9.824346 9.512946 8.729642
## SRR10912127 SRR10912128 SRR10912129 SRR10912130 SRR10912131
## ENSG00000000003 11.547610 11.424025 10.516266 11.203384 11.180243
## ENSG00000000005 7.042143 6.323793 7.599408 6.528323 6.551915
## ENSG00000000419 9.701540 9.541748 9.518293 9.632376 9.832567
## ENSG00000000457 9.114526 8.892260 8.684853 8.941324 8.812885
## ENSG00000000460 7.324757 7.774050 7.157379 7.359458 7.265680
## ENSG00000000938 6.771086 7.184867 7.623889 6.985543 6.601337
## ENSG00000000971 12.267779 12.696265 13.118564 12.085980 13.146398
## ENSG00000001036 10.692839 10.466388 10.706315 10.629241 10.610018
## ENSG00000001084 9.104741 9.686723 8.441543 8.613121 8.722025
## ENSG00000001167 9.628640 9.590581 9.300408 9.290722 9.664211
## SRR10912132 SRR10912133 SRR10912134 SRR10912135 SRR10912136
## ENSG00000000003 11.088528 11.352780 11.561319 11.162601 11.080903
## ENSG00000000005 8.238922 6.339365 6.550300 6.678743 7.238449
## ENSG00000000419 9.625747 9.802675 9.827910 9.769506 9.699860
## ENSG00000000457 8.813425 9.015513 9.136782 9.105001 8.784260
## ENSG00000000460 7.458393 7.507021 7.670911 7.478916 7.214206
## ENSG00000000938 8.016745 6.866548 6.405736 6.888255 6.576864
## ENSG00000000971 12.678047 13.099437 12.717134 12.577411 12.899147
## ENSG00000001036 10.349596 10.100810 10.584969 10.678041 10.562391
## ENSG00000001084 8.974784 8.976818 9.283510 8.705346 8.533921
## ENSG00000001167 9.426759 9.643702 9.801436 9.741259 9.475391
## SRR10912137 SRR10912138 SRR10912139 SRR10912140 SRR10912141
## ENSG00000000003 11.203735 10.462749 10.558232 9.352170 10.087283
## ENSG00000000005 7.240333 5.657905 5.876671 5.813607 5.927808
## ENSG00000000419 9.615981 10.624721 10.246869 9.749570 10.352192
## ENSG00000000457 8.866021 8.297502 8.579115 8.191324 8.416318
## ENSG00000000460 7.369684 7.890839 8.262644 7.675062 8.050090
## ENSG00000000938 6.577731 9.096736 8.967233 9.853455 9.511546
## ENSG00000000971 12.715642 11.472347 9.754289 11.011983 10.036134
## ENSG00000001036 10.475592 10.888224 10.426827 10.865948 9.660181
## ENSG00000001084 8.320703 8.781438 9.308742 9.567728 9.451031
## ENSG00000001167 9.782998 9.436212 9.320109 9.178360 9.010589
## SRR10912142 SRR10912143 SRR10912144 SRR10912145 SRR10912146
## ENSG00000000003 9.486470 11.422991 10.814979 9.913147 10.431310
## ENSG00000000005 6.957346 6.033677 5.657905 5.727410 6.085379
## ENSG00000000419 9.403874 10.087039 9.755601 9.566692 10.049713
## ENSG00000000457 8.619509 9.217822 9.031900 9.129272 8.795796
## ENSG00000000460 7.402051 8.392672 7.177641 8.066668 8.656107
## ENSG00000000938 10.139142 8.430335 8.337217 8.964144 8.971527
## ENSG00000000971 12.144935 10.191008 11.952959 9.673892 9.778397
## ENSG00000001036 10.341637 10.420020 10.289594 10.281137 10.391436
## ENSG00000001084 9.295030 8.900146 9.200154 9.180694 9.221930
## ENSG00000001167 8.899336 9.471624 9.227674 9.078129 10.028288
## SRR10912147 SRR10912148 SRR10912149 SRR10912150 SRR10912151
## ENSG00000000003 10.984098 11.419437 10.896370 9.860183 9.919823
## ENSG00000000005 6.700062 6.226983 5.657905 5.657905 9.117115
## ENSG00000000419 10.679558 10.030078 10.530196 9.784860 10.341940
## ENSG00000000457 8.633689 8.824891 8.475233 8.598698 8.898314
## ENSG00000000460 7.395527 8.772661 7.720103 7.824260 6.559439
## ENSG00000000938 6.700062 7.824077 8.083384 7.539390 8.799438
## ENSG00000000971 9.338240 8.928647 11.302693 11.403038 12.637810
## ENSG00000001036 9.715562 10.989807 10.136391 9.704060 10.482927
## ENSG00000001084 9.067209 9.228072 9.115244 8.555554 9.745390
## ENSG00000001167 8.152816 8.548046 7.949802 8.271179 8.668850
## SRR10912152 SRR10912153 SRR10912154 SRR10912155 SRR10912156
## ENSG00000000003 10.078535 9.852815 10.388402 10.079501 10.611783
## ENSG00000000005 5.657905 5.657905 5.657905 5.911852 5.657905
## ENSG00000000419 10.259810 9.957853 10.290172 10.147716 9.596196
## ENSG00000000457 8.836992 8.558326 9.535682 8.058282 8.434271
## ENSG00000000460 8.548649 8.248089 7.897485 7.859239 7.377141
## ENSG00000000938 7.454627 7.996913 8.775385 8.859813 9.795498
## ENSG00000000971 9.647801 8.380668 9.766278 10.540512 10.740995
## ENSG00000001036 10.034946 9.980854 10.135844 10.385985 9.278702
## ENSG00000001084 8.153185 8.961764 8.649668 9.824866 8.309312
## ENSG00000001167 8.299080 8.384380 8.473338 8.762909 8.366951
## SRR10912157 SRR10912158 SRR10912159 SRR10912160 SRR10912161
## ENSG00000000003 11.795582 11.389175 7.463260 8.449949 5.657905
## ENSG00000000005 5.907736 5.657905 5.657905 5.657905 5.657905
## ENSG00000000419 10.287970 10.563573 9.092711 9.122085 5.657905
## ENSG00000000457 8.777955 8.552365 6.973376 8.080911 5.657905
## ENSG00000000460 8.639941 8.412397 7.810745 7.763193 5.657905
## ENSG00000000938 6.290565 7.764174 11.197375 11.934724 11.921847
## ENSG00000000971 7.195523 8.474792 11.224753 10.904849 10.797183
## ENSG00000001036 10.550255 9.306829 10.587098 10.629538 10.797183
## ENSG00000001084 9.542411 9.288514 8.311946 8.905904 9.011239
## ENSG00000001167 8.875595 8.397589 8.830090 8.740883 5.657905
## SRR10912162 SRR10912163 SRR10912164 SRR10912165 SRR10912166
## ENSG00000000003 7.943794 10.470963 10.605714 10.772655 5.657905
## ENSG00000000005 5.657905 5.657905 5.657905 5.657905 5.657905
## ENSG00000000419 9.325488 10.749076 10.105470 9.926235 5.657905
## ENSG00000000457 8.664924 8.612039 7.967889 8.958865 5.657905
## ENSG00000000460 8.351213 7.970324 8.427629 8.506545 5.657905
## ENSG00000000938 10.214300 8.446406 7.254249 6.790146 11.211340
## ENSG00000000971 10.116392 8.700865 8.427629 8.212602 11.211340
## ENSG00000001036 10.305962 10.482355 9.651894 9.800036 11.211340
## ENSG00000001084 8.920954 9.674335 8.846012 8.745098 5.657905
## ENSG00000001167 8.664924 9.544415 9.331168 9.379211 5.657905
## SRR10912167 SRR10912168 SRR10912169 SRR10912170 SRR10912171
## ENSG00000000003 8.180514 10.547861 8.892073 10.261833 10.917607
## ENSG00000000005 5.657905 5.657905 5.657905 5.833176 6.128923
## ENSG00000000419 8.975025 9.892837 10.827876 9.939263 10.724170
## ENSG00000000457 8.521530 8.840929 8.410319 8.561306 8.410402
## ENSG00000000460 7.517007 7.740980 8.389061 8.253949 8.627841
## ENSG00000000938 12.081720 8.816368 8.525899 7.856368 6.977212
## ENSG00000000971 11.537685 10.113472 8.329650 9.293253 9.651555
## ENSG00000001036 10.560302 9.520768 9.799506 10.599937 10.217742
## ENSG00000001084 8.597257 8.543741 9.788173 9.166928 9.180999
## ENSG00000001167 9.195511 9.555541 8.323244 9.571613 8.751902
## SRR10912172
## ENSG00000000003 8.903937
## ENSG00000000005 5.657905
## ENSG00000000419 9.165333
## ENSG00000000457 8.142573
## ENSG00000000460 7.627294
## ENSG00000000938 11.488695
## ENSG00000000971 10.114272
## ENSG00000001036 10.389456
## ENSG00000001084 9.028052
## ENSG00000001167 8.914531
meanSdPlot(assay(ntd))
meanSdPlot(assay(vsd))
#meanSdPlot(assay(rld))
library("pheatmap")
select <- order(rowMeans(counts(dds,normalized=TRUE)),
decreasing=TRUE)[1:20]
df <- as.data.frame(colData(dds)[,c("Tissue","Treatment")])
pheatmap(assay(ntd)[select,], cluster_rows=FALSE, show_rownames=FALSE,
cluster_cols=FALSE, annotation_col=df)
pheatmap(assay(vsd)[select,], cluster_rows=FALSE, show_rownames=FALSE,
cluster_cols=FALSE, annotation_col=df)
#pheatmap(assay(rld)[select,], cluster_rows=FALSE, show_rownames=FALSE,
# cluster_cols=FALSE, annotation_col=df)
sampleDists <- dist(t(assay(vsd)))
library("RColorBrewer")
sampleDistMatrix <- as.matrix(sampleDists)
rownames(sampleDistMatrix) <- paste(vsd$condition, vsd$type, sep="-")
colnames(sampleDistMatrix) <- NULL
colors <- colorRampPalette( rev(brewer.pal(9, "Blues")) )(255)
pheatmap(sampleDistMatrix,
clustering_distance_rows=sampleDists,
clustering_distance_cols=sampleDists,
col=colors)
plotPCA(vsd, intgroup=c("Tissue"))
results(dds, contrast=c("Tissue","Serous_EOC","Benign_Tissue"))
## log2 fold change (MLE): Tissue Serous_EOC vs Benign_Tissue
## Wald test p-value: Tissue Serous EOC vs Benign Tissue
## DataFrame with 19975 rows and 6 columns
## baseMean log2FoldChange lfcSE stat pvalue
## <numeric> <numeric> <numeric> <numeric> <numeric>
## ENSG00000000003 1359.4263 -0.790170 0.248072 -3.185252 1.44628e-03
## ENSG00000000005 28.6264 -0.512972 0.913941 -0.561275 5.74610e-01
## ENSG00000000419 945.1298 0.408815 0.156660 2.609561 9.06584e-03
## ENSG00000000457 339.0323 -0.139602 0.124784 -1.118752 2.63246e-01
## ENSG00000000460 189.3951 1.346737 0.231249 5.823762 5.75375e-09
## ... ... ... ... ... ...
## ENSG00000273294 18.6100019 0.115738 0.774778 0.1493822 0.881252
## ENSG00000273331 1.6135503 2.457218 1.142924 2.1499398 0.031560
## ENSG00000273398 5.7510137 0.562653 0.536606 1.0485403 0.294390
## ENSG00000273439 22.4666648 0.669630 0.415259 1.6125583 0.106841
## ENSG00000273452 0.0657423 0.197680 4.954781 0.0398967 0.968175
## padj
## <numeric>
## ENSG00000000003 3.91623e-03
## ENSG00000000005 6.64751e-01
## ENSG00000000419 1.99003e-02
## ENSG00000000457 3.58693e-01
## ENSG00000000460 5.14674e-08
## ... ...
## ENSG00000273294 0.9141591
## ENSG00000273331 0.0593248
## ENSG00000273398 0.3925197
## ENSG00000273439 0.1682453
## ENSG00000273452 NA
resApeT <- lfcShrink(dds, coef=2, type="apeglm", lfcThreshold=1)
## using 'apeglm' for LFC shrinkage. If used in published research, please cite:
## Zhu, A., Ibrahim, J.G., Love, M.I. (2018) Heavy-tailed prior distributions for
## sequence count data: removing the noise and preserving large differences.
## Bioinformatics. https://doi.org/10.1093/bioinformatics/bty895
## computing FSOS 'false sign or small' s-values (T=1)
plotMA(resApeT, ylim=c(-3,3), cex=.8)
## thresholding s-values on alpha=0.005 to color points
abline(h=c(-1,1), col="dodgerblue", lwd=2)
resAshT <- lfcShrink(dds, coef=2, type="ashr", lfcThreshold=1)
## using 'ashr' for LFC shrinkage. If used in published research, please cite:
## Stephens, M. (2016) False discovery rates: a new deal. Biostatistics, 18:2.
## https://doi.org/10.1093/biostatistics/kxw041
## computing FSOS 'false sign or small' s-values (T=1)
plotMA(resAshT, ylim=c(-3,3), cex=.8)
## thresholding s-values on alpha=0.005 to color points
abline(h=c(-1,1), col="dodgerblue", lwd=2)
par(mar=c(8,5,2,2))
boxplot(log10(assays(dds)[["cooks"]]), range=0, las=2)
plotDispEsts(dds)
metadata(resLFC_Serous_EOC)$alpha
## [1] 0.1
metadata(resLFC_Serous_EOC)$filterThreshold
## 3.896759%
## 0.2997622
plot(metadata(resLFC_Serous_EOC)$filterNumRej,
type="b", ylab="number of rejections",
xlab="quantiles of filter")
lines(metadata(resLFC_Serous_EOC)$lo.fit, col="red")
abline(v=metadata(resLFC_Serous_EOC)$filterTheta)
resNoFilt <- results(dds, independentFiltering=FALSE)
addmargins(table(filtering=(resLFC_Serous_EOC$padj < .1),
noFiltering=(resNoFilt$padj < .1)))
## noFiltering
## filtering FALSE TRUE Sum
## FALSE 8060 0 8060
## TRUE 84 11052 11136
## Sum 8144 11052 19196
metadata(resLFC_Ascites)$alpha
## [1] 0.1
metadata(resLFC_Ascites)$filterThreshold
## 0.02002503%
## 0.005648919
plot(metadata(resLFC_Ascites)$filterNumRej,
type="b", ylab="number of rejections",
xlab="quantiles of filter")
lines(metadata(resLFC_Ascites)$lo.fit, col="red")
abline(v=metadata(resLFC_Ascites)$filterTheta)
resNoFilt <- results(dds, independentFiltering=FALSE)
addmargins(table(filtering=(resLFC_Ascites$padj < .1),
noFiltering=(resNoFilt$padj < .1)))
## noFiltering
## filtering FALSE TRUE Sum
## FALSE 5118 2094 7212
## TRUE 3801 8958 12759
## Sum 8919 11052 19971
par(mfrow=c(2,2),mar=c(2,2,1,1))
ylim <- c(-2.5,2.5)
resGA <- results(dds, lfcThreshold=.5, altHypothesis="greaterAbs")
resLA <- results(dds, lfcThreshold=.5, altHypothesis="lessAbs")
resG <- results(dds, lfcThreshold=.5, altHypothesis="greater")
resL <- results(dds, lfcThreshold=.5, altHypothesis="less")
drawLines <- function() abline(h=c(-.5,.5),col="dodgerblue",lwd=2)
plotMA(resGA, ylim=ylim); drawLines()
plotMA(resLA, ylim=ylim); drawLines()
plotMA(resG, ylim=ylim); drawLines()
plotMA(resL, ylim=ylim); drawLines()
#mcols(dds,use.names=TRUE)[1:4,1:4]
#substr(names(mcols(dds)),1,10)
#mcols(mcols(dds), use.names=TRUE)[1:4,]
#head(assays(dds)[["mu"]])
#head(assays(dds)[["cooks"]])
#head(dispersions(dds))
#head(mcols(dds)$dispersion)
#sizeFactors(dds)
#head(coef(dds))
#attr(dds, "betaPriorVar")
#priorInfo(resLFC)
library("AnnotationDbi")
library("org.Hs.eg.db")
##
final_data_Serous <- read.csv('Final_Data_LFC_Serous_EOC.csv')
final_data_Serous$symbol <- mapIds(org.Hs.eg.db, keys = final_data_Serous$X, column = 'SYMBOL', keytype = 'ENSEMBL')
## 'select()' returned 1:many mapping between keys and columns
final_data_Serous <- final_data_Serous[order(final_data_Serous$pvalue),]
head(final_data_Serous, 50)
## X baseMean log2FoldChange lfcSE pvalue
## 2280 ENSG00000100380 5724.96499 -2.366535 0.1601225 6.747169e-50
## 9682 ENSG00000154545 61.40843 11.232181 3.5294452 9.463669e-50
## 2216 ENSG00000100227 1539.32309 -1.927756 0.1436224 2.460812e-41
## 7803 ENSG00000139734 173.22782 4.271019 0.3212016 9.455479e-41
## 1090 ENSG00000069966 566.39767 -2.153479 0.1634850 4.286271e-40
## 16378 ENSG00000196839 229.11553 2.378881 0.1868901 8.342579e-38
## 1770 ENSG00000088325 1169.30542 4.383619 0.3511531 1.148710e-37
## 7554 ENSG00000138180 416.12170 4.765852 0.3811779 2.852664e-37
## 18107 ENSG00000215298 33.08025 10.777277 4.0612932 6.886416e-37
## 12487 ENSG00000169679 391.34577 4.145891 0.3398087 6.577500e-36
## 9046 ENSG00000148773 1080.00392 4.341723 0.3616491 3.673715e-35
## 11477 ENSG00000165480 121.06319 3.984229 0.3236120 7.013135e-35
## 5110 ENSG00000121152 211.51483 4.233840 0.3543575 6.315500e-34
## 6423 ENSG00000131747 1159.48202 4.176065 0.3611308 8.299477e-33
## 12935 ENSG00000171700 461.50253 2.475897 0.2162880 2.153309e-31
## 5392 ENSG00000123843 129.27485 -3.469274 0.2995853 2.190238e-31
## 3687 ENSG00000109805 334.73959 4.094134 0.3615999 2.353862e-31
## 11271 ENSG00000164611 496.61379 3.671111 0.3229150 4.220011e-31
## 4009 ENSG00000112242 575.60515 2.399186 0.2111830 4.720339e-31
## 1844 ENSG00000089685 598.18916 4.314461 0.3844641 5.260845e-31
## 10002 ENSG00000157456 350.27085 3.846288 0.3409431 7.250601e-31
## 8275 ENSG00000143228 232.28054 3.839719 0.3421960 1.470819e-30
## 4081 ENSG00000112742 275.04632 4.183609 0.3760899 2.478286e-30
## 1372 ENSG00000077152 266.52244 3.316052 0.2964858 3.620661e-30
## 1197 ENSG00000072571 203.57910 3.767188 0.3388903 3.821498e-30
## 2420 ENSG00000101057 791.63169 4.677631 0.4245496 5.013545e-30
## 2516 ENSG00000101440 25.18471 -4.738041 0.4179163 5.225295e-30
## 4351 ENSG00000115163 159.78382 4.494506 0.4012504 9.625444e-30
## 923 ENSG00000065328 144.22937 3.772094 0.3401611 1.043422e-29
## 2523 ENSG00000101447 334.37476 4.109514 0.3763048 1.208282e-29
## 441 ENSG00000024526 225.58850 4.359077 0.3985200 2.076110e-29
## 14873 ENSG00000183287 422.64699 -3.630607 0.3253830 2.888063e-29
## 16917 ENSG00000198759 1127.80522 4.974515 0.4605761 3.667403e-29
## 14703 ENSG00000182481 2184.86118 2.733599 0.2508030 4.656406e-29
## 14757 ENSG00000182749 560.73077 -2.090683 0.1887148 6.188864e-29
## 3837 ENSG00000111206 780.85397 3.453181 0.3189707 6.999166e-29
## 16001 ENSG00000188730 126.42062 -5.363570 0.4823545 9.363982e-29
## 5377 ENSG00000123610 152.47400 5.081451 0.4642499 1.048219e-28
## 1198 ENSG00000072609 646.72286 1.419510 0.1293494 1.514072e-28
## 3846 ENSG00000111247 244.58649 3.034891 0.2809467 1.542488e-28
## 12834 ENSG00000171241 192.96019 3.138808 0.2910370 1.771562e-28
## 8938 ENSG00000147852 1134.30223 -3.043523 0.2772773 1.792106e-28
## 15017 ENSG00000183856 519.38832 4.345821 0.4069458 2.576997e-28
## 8223 ENSG00000142945 495.98642 3.918577 0.3673788 2.604511e-28
## 3141 ENSG00000105664 1740.27329 7.259892 0.6897367 2.897477e-28
## 18234 ENSG00000221955 679.22724 3.435748 0.3214557 3.241857e-28
## 12974 ENSG00000171848 565.55775 3.045456 0.2841631 3.339219e-28
## 9944 ENSG00000156970 295.96475 3.459288 0.3248491 4.514570e-28
## 5805 ENSG00000126787 267.17163 4.092292 0.3856053 9.048349e-28
## 8107 ENSG00000141905 1564.72016 -1.795886 0.1662445 1.107383e-27
## padj symbol
## 2280 9.083229e-46 ST13
## 9682 9.083229e-46 MAGED4
## 2216 1.574592e-37 POLDIP3
## 7803 4.537684e-37 DIAPH3
## 1090 1.645585e-36 GNB5
## 16378 2.669069e-34 ADA
## 1770 3.150091e-34 TPX2
## 7554 6.844966e-34 CEP55
## 18107 1.468796e-33 <NA>
## 12487 1.262617e-32 BUB1
## 9046 6.410967e-32 MKI67
## 11477 1.121868e-31 SKA3
## 5110 9.325564e-31 NCAPH
## 6423 1.137977e-29 TOP2A
## 12935 2.627739e-28 RGS19
## 5392 2.627739e-28 C4BPB
## 3687 2.657926e-28 NCAPG
## 11271 4.500407e-28 PTTG1
## 4009 4.769033e-28 E2F3
## 1844 5.049359e-28 BIRC5
## 10002 6.627740e-28 CCNB2
## 8275 1.283356e-27 NUF2
## 4081 2.068399e-27 TTK
## 1372 2.895925e-27 UBE2T
## 1197 2.934299e-27 HMMR
## 2420 3.701539e-27 MYBL2
## 2516 3.714991e-27 ASIP
## 4351 6.598929e-27 CENPA
## 923 6.906735e-27 MCM10
## 2523 7.731394e-27 FAM83D
## 441 1.285581e-26 DEPDC1
## 14873 1.732477e-26 CCBE1
## 16917 2.133317e-26 EGFL6
## 14703 2.628952e-26 KPNA2
## 14757 3.394327e-26 PAQR7
## 3837 3.732111e-26 FOXM1
## 16001 4.858135e-26 VWC2
## 5377 5.295163e-26 TNFAIP6
## 1198 7.402399e-26 CHFR
## 3846 7.402399e-26 RAD51AP1
## 12834 8.190776e-26 SHCBP1
## 8938 8.190776e-26 VLDLR
## 15017 1.136277e-25 IQGAP3
## 8223 1.136277e-25 KIF2C
## 3141 1.235999e-25 COMP
## 18234 1.352841e-25 SLC12A8
## 12974 1.363822e-25 RRM2
## 9944 1.805452e-25 BUB1B
## 5805 3.544737e-25 DLGAP5
## 8107 4.251464e-25 NFIC
final_data_Ascites <- read.csv('Final_Data_LFC_Ascites.csv')
final_data_Ascites$symbol <- mapIds(org.Hs.eg.db, keys = final_data_Ascites$X, column = 'SYMBOL', keytype = 'ENSEMBL')
## 'select()' returned 1:many mapping between keys and columns
final_data_Ascites <- final_data_Ascites[order(final_data_Ascites$pvalue),]
head(final_data_Ascites, 50)
## X baseMean log2FoldChange lfcSE pvalue
## 4410 ENSG00000115461 16817.08019 -6.766741 0.4209936 4.156538e-58
## 2280 ENSG00000100380 5724.96499 -2.749551 0.1781409 2.862340e-54
## 1209 ENSG00000072840 769.00105 -3.363033 0.2232460 7.753422e-52
## 2216 ENSG00000100227 1539.32309 -2.416056 0.1613224 2.936158e-51
## 4194 ENSG00000113658 1041.52626 -2.286800 0.1585170 1.053932e-47
## 4809 ENSG00000118640 2766.78334 3.871327 0.2781654 2.250980e-45
## 11261 ENSG00000164574 1551.57933 -3.680226 0.2639437 5.407182e-45
## 1924 ENSG00000091436 1251.49413 -3.798562 0.2736679 2.292355e-44
## 14389 ENSG00000180357 819.64498 -2.095509 0.1508520 3.046458e-44
## 1090 ENSG00000069966 566.39767 -2.530313 0.1842996 2.728464e-43
## 8092 ENSG00000141720 1522.08596 -2.120037 0.1546516 3.372399e-43
## 3841 ENSG00000111229 3753.62933 1.663285 0.1206307 4.872496e-43
## 7918 ENSG00000140543 138.51741 -2.592467 0.1912299 1.532077e-42
## 11027 ENSG00000163820 798.28237 -2.786760 0.2085839 1.632047e-41
## 15073 ENSG00000184207 578.75359 2.887580 0.2170007 1.727614e-41
## 9682 ENSG00000154545 61.40843 10.796944 3.6045524 4.601302e-41
## 1809 ENSG00000089057 1005.89933 -2.735223 0.2068275 6.323177e-41
## 10094 ENSG00000158258 1125.91097 -6.095347 0.4558747 7.334541e-41
## 16378 ENSG00000196839 229.11553 2.746156 0.2083082 1.988212e-40
## 9239 ENSG00000150760 1196.20071 -2.184512 0.1657465 5.495730e-40
## 9251 ENSG00000150907 1129.39294 -3.533868 0.2688621 7.581393e-40
## 7926 ENSG00000140577 937.43722 -2.875797 0.2199557 7.790204e-40
## 11271 ENSG00000164611 496.61379 4.635777 0.3564130 9.545710e-40
## 11873 ENSG00000167074 615.93585 -3.346519 0.2564730 1.743841e-39
## 12704 ENSG00000170653 777.55511 -1.810626 0.1394129 5.215307e-39
## 1558 ENSG00000082175 367.99463 -7.875171 0.6011838 5.722751e-39
## 8489 ENSG00000144445 421.28187 -2.167882 0.1672635 8.997096e-39
## 10100 ENSG00000158301 326.81998 -4.133615 0.3200302 9.061444e-39
## 2252 ENSG00000100320 2020.23680 -2.638264 0.2043416 9.176720e-39
## 7145 ENSG00000136111 743.08883 -4.240211 0.3274465 1.049670e-38
## 4417 ENSG00000115504 825.88386 -2.683715 0.2074528 1.110653e-38
## 18966 ENSG00000249242 299.88110 -4.701757 0.3636611 1.612567e-38
## 6320 ENSG00000131018 1294.67531 -4.585675 0.3573770 1.723938e-38
## 11795 ENSG00000166783 1382.42731 -1.865451 0.1443335 2.355278e-38
## 2831 ENSG00000103657 1028.96224 -2.041921 0.1596197 5.691320e-38
## 6335 ENSG00000131089 432.50559 -2.431705 0.1912510 1.544106e-37
## 2254 ENSG00000100324 462.88611 -1.932270 0.1523835 1.560118e-37
## 13467 ENSG00000174485 273.99563 -2.303004 0.1815890 2.447879e-37
## 15364 ENSG00000185551 3099.39881 -4.350840 0.3417257 3.205223e-37
## 7644 ENSG00000138688 1228.68677 -2.051523 0.1633682 1.434492e-36
## 399 ENSG00000020181 1145.56744 -5.417010 0.4341985 2.411756e-36
## 15709 ENSG00000187240 368.43998 -2.941907 0.2365892 4.054844e-36
## 863 ENSG00000063587 889.69004 -3.179799 0.2559716 5.350762e-36
## 5890 ENSG00000127603 4721.59003 -1.954497 0.1570793 6.035839e-36
## 9996 ENSG00000157404 334.79742 -6.776571 0.5421366 6.416311e-36
## 11981 ENSG00000167553 5217.60943 3.045495 0.2476570 6.839267e-36
## 1107 ENSG00000070366 954.70711 -2.255985 0.1818605 8.455774e-36
## 13342 ENSG00000173714 518.81452 -10.453879 0.8596890 1.146955e-35
## 16609 ENSG00000197724 860.07611 -2.069177 0.1667896 1.202119e-35
## 4147 ENSG00000113319 310.26753 -5.227584 0.4236730 1.268900e-35
## padj symbol
## 4410 8.301023e-54 IGFBP5
## 2280 2.858189e-50 ST13
## 1209 5.161453e-48 EVC
## 2216 1.465950e-47 POLDIP3
## 4194 4.209616e-44 SMAD5
## 4809 7.492388e-42 VAMP8
## 11261 1.542669e-41 GALNT10
## 1924 5.722577e-41 MAP3K20
## 14389 6.760089e-41 ZNF609
## 1090 5.449016e-40 GNB5
## 8092 6.122744e-40 <NA>
## 3841 8.109052e-40 ARPC3
## 7918 2.353624e-39 DET1
## 11027 2.300146e-38 FYCO1
## 15073 2.300146e-38 PGP
## 9682 5.743288e-38 MAGED4
## 1809 7.428246e-38 SLC23A2
## 10094 8.137673e-38 CLSTN2
## 16378 2.089820e-37 ADA
## 9239 5.487761e-37 DOCK1
## 9251 7.071735e-37 FOXO1
## 7926 7.071735e-37 CRTC3
## 11271 8.288582e-37 PTTG1
## 11873 1.451094e-36 TEF
## 12704 4.166196e-36 ATF7
## 1558 4.395733e-36 PGR
## 8489 6.319596e-36 KANSL1L
## 10100 6.319596e-36 GPRASP2
## 2252 6.319596e-36 RBFOX2
## 7145 6.987653e-36 TBC1D4
## 4417 7.155111e-36 EHBP1
## 18966 1.006393e-35 TMEM150C
## 6320 1.043296e-35 SYNE1
## 11795 1.383449e-35 MARF1
## 2831 3.247467e-35 HERC1
## 6335 8.420842e-35 ARHGEF9
## 2254 8.420842e-35 TAB1
## 13467 1.286490e-34 DENND4A
## 15364 1.641321e-34 NR2F2
## 7644 7.162062e-34 BLTP1
## 399 1.174761e-33 ADGRA2
## 15709 1.928078e-33 DYNC2H1
## 863 2.485118e-33 ZNF275
## 5890 2.739585e-33 MACF1
## 9996 2.847559e-33 KIT
## 11981 2.969283e-33 TUBA1C
## 1107 3.592984e-33 SMG6
## 13342 4.772049e-33 WFIKKN2
## 16609 4.899493e-33 PHF2
## 4147 5.068241e-33 RASGRF2